<template>
  <div>
    <div class="job-page send-page">
      <div class="job-page-center">
        <div class="job-content">
          <div class="job-content-left">
            <div class="send-content">
              <div class="send-content-head">
                <div class="send-head-title">已投递简历状态</div>
                <!-- <div class="send-refresh" @click="getData">
                  <img src="../../assets/img/resume/shuaxin.png">刷新
                </div>-->
              </div>
              <div class="send-content-menu">
                <el-menu mode="horizontal" :default-active="params.menuIndex" @select="doMenu">
                  <el-menu-item
                    v-for="(item,index) in title"
                    :index="index+''"
                    :key="index+''"
                  >{{item.label}}</el-menu-item>
                </el-menu>
              </div>
              <send-list
                :data="resumeDeliveryLists"
                v-model="params.currPageNo"
                @on-pitch="getData"
              ></send-list>
            </div>
          </div>
          <div class="job-content-right">
            <div
              class="job-box job-advertising"
              v-for="(item,index) in bannerDtoList"
              :key="index"
              @click="toAdvertising(item.url)"
            >
              <img :src="item.image" alt>
            </div>
          </div>
        </div>
      </div>
    </div>
    <page-footer></page-footer>
  </div>
</template>

<script>
import sendList from './send-list'
import pageFooter from '../../components/page-footer'
export default {
  data() {
    return {
      params: {
        menuIndex: '0',
        talentId: 3,
        page: {
          currPageNo: 1,
          pageSize: 20
        }
      },
      resumeDeliveryLists: [],
      bannerDtoList: [],
      resumeDeliveryList: {},
      title: [
        { label: '投递中' },
        { label: '投递成功' },
        { label: '待入职' },
        { label: '入职成功' },
        { label: '不合适' }
      ]
    }
  },
  methods: {
    doMenu(key) {
      this.params.menuIndex = key
      this.getData()
    },
    getData() {
      _g.apiPost('/talent/initResumeDeliveryPage.do', this.params).then(res => {
        if (res && res.status === 0) {
          this.resumeDeliveryLists = res.data.resumeDeliveryList
          this.bannerDtoList.length = 0
          res.data.bannerDtoList.forEach(banner => {
            let cjson = JSON.parse(banner.content)
            this.bannerDtoList.push({ image: cjson.image, url: cjson.url })
          })
        }
      })
    },
    toAdvertising(url) {
      //跳转到广告链接
      // window.location.href = url
      if (url.indexOf('//') == -1) {
        window.open('//' + url, '_blank')
      } else {
        window.open(url, '_blank')
      }
    }
  },
  mounted() {
    this.getData()
  },
  components: {
    sendList,
    pageFooter
  }
}
</script>

<style lang="scss" scoped>
</style>
